import {createSlice} from '@reduxjs/toolkit';

const userStore = createSlice({
    initialState: {
        userId:1123,
        num:1,
    },
    name: 'userStore',
    reducers: {
        // 用户登录
        login: (state, action) => {
            state.userId = action.payload;
        },
        addNum: (state, action) => {
            state.num += action.payload;
        },
        
    }
})
const {login,addNum} = userStore.actions;
const userReducer = userStore.reducer;
export {login,addNum};
export default userReducer;